package com.aat.dxfy.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class RedisBaseDemo {

	private static JedisPool jedisPool;

	public static void main(String[] args) {
		// 池基本配置 high-performance
		JedisPoolConfig config = new JedisPoolConfig();
		config.setMaxIdle(5);
		config.setMaxWaitMillis(100L);
		config.setTestOnBorrow(false);

		//jedisPool = new JedisPool(config, "r-2ze5f9c37c0b31b4.redis.rds.aliyuncs.com", 6379, 0, "AATredis1236");
		//jedisPool = new JedisPool(config, "127.0.0.1", 6379);
		jedisPool = new JedisPool(config, "127.0.0.1", 6379,0, "root");
		Jedis jedis = jedisPool.getResource();
		jedis.set("1", "123");
		Long l1=System.currentTimeMillis();
		System.out.println(jedis.get("1"));
		Long l2=System.currentTimeMillis();
		System.out.println(l2-l1);
		jedis.setex("2", 10, "235");
	}

}
